package com.example.endpoint;

import com.example.serviceapi.TestService1;
import com.example.serviceapi.TestService2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.remoting.rmi.RmiProxyFactoryBean;

@SpringBootApplication
public class EndpointApplication {

    public static void main(String[] args) {
        SpringApplication.run(EndpointApplication.class, args);
    }

    @Bean
    public RmiProxyFactoryBean rmiProxyFactoryBean1() {
        RmiProxyFactoryBean bean = new RmiProxyFactoryBean();
        bean.setServiceUrl("rmi://localhost:6667/testServiceImpl1");
        bean.setServiceInterface(TestService1.class);
        return bean;
    }

    @Bean
    public RmiProxyFactoryBean rmiProxyFactoryBean2() {
        RmiProxyFactoryBean bean = new RmiProxyFactoryBean();
        bean.setServiceUrl("rmi://localhost:6667/testServiceImpl2");
        bean.setServiceInterface(TestService2.class);
        return bean;
    }

}
